<template>
  <div class="page-common-layout">
    <div class="page-common-content">
      <tool-bar
        @search="$refs.table.refresh(true)"
        @reset="$refs.table.refresh(true),queryParam = {}"
      >
        <template slot="toolBtn" slot-scope="scope">
          <a-button
					  class="cu-btn-primary"
					  icon="plus"
					  @click="handleAdd()"
					  v-action:formClassifyAddDialog
					>新建表单分类</a-button>
        </template>
				<template slot="toolForm">
				  <a-form-item label="名称">
				    <a-input v-model="queryParam.classifyName" placeholder="名称" />
				  </a-form-item>
          <a-form-item label="编码">
				    <a-input v-model="queryParam.classifyCode" placeholder="编码" />
				  </a-form-item>
				</template>
      </tool-bar>
      <DataGrid ref="table" :columns="columns" :url="url" :queryParam="queryParam" rowKey="uuid" :showRowSelect="false">
        <span slot="renderCreator" slot-scope="{ text, record, index }">
          {{ text }}/{{ record.creatorId }}
        </span>
				<span slot="renderAction" slot-scope="{ text, record, index }">
          <template>
            <a @click="handleEdit(record)">{{$ct("edit","编辑")}}</a>
            <span class="action-margin"></span>
            <a @click="handleSub(record)" class="action-delete">{{$ct("delete","删除")}}</a>
          </template>
        </span>
			</DataGrid>
      <!--	新增编辑	 -->
      <edit-form
        ref="createModal"
        :visible="visible"
        :loading="confirmLoading"
        :model="mdl"
        @cancel="handleCancel()"
        @ok="handleOk()"
      />
    </div>
  </div>
</template>

<script>
import {
  DataGrid
} from "@/components";
import {
  dataGridMixin
} from "@/mixins/dataGridMixin";
import editForm from "./edit";
export default {
  name: "Table",
  components: { DataGrid, editForm, },
  mixins: [dataGridMixin],
  data() {
    return {
      columns: [
        {
          title: "名称",
          align: "left",
          dataIndex: "classifyName",
          langCode: "name",
        },
        {
          title: "编码",
          align: "left",
          dataIndex: "classifyCode",
        },
        {
          title: "排序",
          dataIndex: "classifySort",
          align: "center",
          langCode: "sort",
          width: 50
        },
        {
          title: "创建人",
          dataIndex: "creator",
          scopedSlots: { customRender: "renderCreator" },
        },
        {
          title: "创建时间",
          dataIndex: "createTime",
        },
        {
          title: "操作",
          width: 100,
          align: "center",
          dataIndex: "action",
          scopedSlots: { customRender: "renderAction" },
        },
      ],
      visible: false,
      confirmLoading: false,
      mdl: null,
      // 查询参数
      queryParam: {},
      url: {
        getPageSet: "/form/formModule/getPageSet",
        update: "/form/formModule/update",
        deleteBatch: "/form/formModule/deleteBatch",
        save: "/form/formModule/save",
      },
    };
  },

  methods: {},
};
</script>

<style scoped lang="less">
.table {
  background-color: @base-bg-color;
  padding: 24px;
}
</style>
